package com.example.jpandroidtest;

import com.jpandroid.annotations.ForeignKey;
import com.jpandroid.annotations.Primarykey;
import com.jpandroid.annotations.Table;
import com.jpandroid.entity.DomainEntity;
import com.jpandroid.types.GenerationType;
import com.jpandroid.types.LoadType;

@Table("Person")
public class Person extends DomainEntity<Integer>
{
	@Primarykey(name = "id", strategy = GenerationType.AUTO_INCREMENT)
	private Integer id;
	
	private String name;
	
	@ForeignKey(name = "idCity", referencedColumnName = "id", load = LoadType.ALL)
	private City city;

	public Person()
	{ }
	
	public Person(String name, City city)
	{
		this.name = name;
		this.city = city;
	}

	@Override
	public Integer getId()
	{
		return id;
	}

	@Override
	public void setId(Integer id)
	{
		this.id= id;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public City getCity()
	{
		return city;
	}

	public void setCity(City city)
	{
		this.city = city;
	}

}
